import org.junit.Test;
import sort.对数器;

import java.math.BigInteger;
import java.util.*;
import java.util.stream.IntStream;

/**
 * @author aodre , QQ : 480029069
 * @date 2023/5/24 18:18
 */
public class 练习类 {


    public static void main(String[] args) {
        System.out.println("hello world!");
    }

    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int nums[] = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }
        int ansA = 0, ansB = 0;
        for (int i = 0; i < n; i++) {
            double muti = 1;
            for (int j = i; j < n; j++) {
//                muti = muti.multiply(new BigInteger(String.valueOf(nums[j])));
                muti *= nums[j];
                if (muti > 0) {
                    ansA++;
                } else {
                    ansB++;
                }
            }
        }
        System.out.println(ansB + " " + ansA);
        dp(nums);
    }

    public static void dp(int nums[]) {
        int len = nums.length;
        int dp[][] = new int[len + 1][2]; // dp[i][0] 表示 以 i开头的连续区间的 白魔法， 1 表示黑魔法
        int ansA = 0, ansB = 0;
        for (int i = len - 1; i >= 0; i--) {
            if (nums[i] > 0) {
                dp[i][0] = dp[i + 1][0] + 1;
                dp[i][1] = dp[i + 1][1];
            } else {
                dp[i][0] = dp[i + 1][1];
                dp[i][1] = dp[i + 1][0] + 1;
            }
            ansA += dp[i][0];
            ansB += dp[i][1];
        }
        System.out.println(ansB + " " + ansA);
    }


    public List<List<Integer>> solution(int nums[]) {
        List<List<Integer>> ans = new ArrayList<>();
        Deque<Integer> path = new ArrayDeque<>();
        boolean[] used = new boolean[nums.length];
        recursion(ans, path, used, nums);
        return ans;
    }

    // [1,1,2,3]
    public void recursion(List<List<Integer>> ans, Deque<Integer> path, boolean[] used, int nums[]) {
        if (path.size() == nums.length) {
            ans.add(new ArrayList<>(path));
            return;
        }
        for (int i = 0; i < nums.length; i++) {
            if (used[i] || i > 0 && nums[i] == nums[i - 1]) {
                continue;
            }
            used[i] = true;
            path.addLast(nums[i]);
            recursion(ans, path, used, nums);
            path.removeLast();
            used[i] = false;
        }
    }


    // 美团流星 问题重新写

    public static void solve() {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int st[] = new int[n], et[] = new int[n];
        for (int i = 0; i < n; i++) {
            st[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            et[i] = sc.nextInt();
        }

        Map<Integer, Integer> diff = new TreeMap<>();

        for (int i = 0; i < n; i++) {
            diff.put(st[i], diff.getOrDefault(st[i], 0) + 1);
            diff.put(et[i] + 1, diff.getOrDefault(et[i] + 1, 0) - 1);
        }

        Map.Entry<Integer, Integer>[] entries = diff.entrySet().toArray(new Map.Entry[0]);

        int max = 0, sum = 0, ans = 0;
        for (Map.Entry<Integer, Integer> entry : entries) {
            sum += entry.getValue();
            max = Math.max(max, sum);
        }
        // 统计完最大 重合 时间段, 然后 开始 统计 在重合时间段, 等于最大 重合时间段的 这些 观测的时间区间的和
        sum = 0;
        for (int i = 0; i < entries.length - 1; i++) {
            sum += entries[i].getValue();
            if (sum == max) {
                ans += entries[i + 1].getKey() - entries[i].getKey();
            }
        }

        System.out.println(max + " " + ans);
    }


    int ans = 0;  // 这种 回溯 时一定要走到 末尾的
    public boolean recursion(int index,int sum,String s,int aim){
        if(sum == aim && index == s.length()){
            ans += Integer.parseInt(s);
//            return true;
            return true;
        }
        for (int i = index + 1; i <= s.length(); i++) {
            boolean recursion = recursion(i, sum + Integer.parseInt(s.substring(index, i)), s, aim);
            if(recursion){
                return true;
            }
        }
        return false;

    }

    public int solution(int n){
        for (int i = 1; i <= n ; i++) {
            recursion(0,0,String.valueOf(i * i),i);
        }
        return ans;
    }

    @Test
    public void test(){
        System.out.println(solution(10));
    }



}
